﻿CREATE PROCEDURE [dbo].[yaf_user_approve](
                @UserID INT)
AS
    BEGIN
        DECLARE  @CheckEmailID INT
        DECLARE  @Email NVARCHAR(50)
        SELECT @CheckEmailID = CheckEmailID,
               @Email = Email
        FROM   yaf_CheckEmail
        WHERE  UserID = @UserID
        -- Update new user email
        UPDATE yaf_User
        SET    Email = @Email,
               Flags = Flags | 2
        WHERE  UserID = @UserID
        DELETE yaf_CheckEmail
        WHERE  CheckEmailID = @CheckEmailID
        SELECT CONVERT(BIT,1)
    END


